import { RouteRecordRaw } from "vue-router";
//导出路由配置项
import layout from "../layout/index.vue"
//静态路由
export const staticRoutes: Array<RouteRecordRaw> = [
    {
        path: "/login",
        component: () => import("../login/index.vue"),
        meta: { title: 'login',isRule:false }
    }
]
//任意路由
export const anyRoutes: Array<RouteRecordRaw> = [
    {
        path: "/",
        component: layout as any,
        redirect: '/home',
        children: [
            {
                path: "/home",
                name: "home",
                component: () => import("../view/home/index.vue"),
                meta: { title: '主页', icon: 'House',isRule:true }
            },
        ]
    },
    {
        path: "/theme",
        component: layout as any,
        redirect: '/theme',
        children: [
            {
                path: "/theme",
                name: "theme",
                component: () => import("../view/theme/index.vue"),
                meta: { title: '主题', icon: 'HelpFilled',isRule:true }
            },
        ]
    },
    {
        path: "/404",
        component: () => import("../view/404/index.vue")
    }, {
        path: "/:catchAll(.*)",
        redirect: "/404"
    }
]
//权限路由
export const ruleRouter: Array<RouteRecordRaw> = [

    {
        path: "/food",
        component: layout as any,
        redirect: "/food",
        meta:{isRule: true },
        children: [
            {
                path: "/food",
                name: "Food",
                component: () => import("../view/food/index.vue"),
                meta: { title: "食物", icon: 'Watermelon', isRule: true }
            }
        ]
    },
    {
        path: "/list",
        component: layout as any,
        meta:{isRule: true },
        children: [
            {
                path: "/list",
                name: "List",
                redirect: "/list/item1",
                /**
                 * title:菜单标题
                 * icon：菜单图标
                 * isRule：是否鉴权
                 * isChildren：是否有子代
                 */
                meta: { title: "菜单", icon: 'Menu', isRule: true, isChildren: true },
                children: [
                    {
                        path: "/list/item1",
                        name: "item1",
                        component: () => import("../view/list/item1/index.vue"),
                        meta: { title: "一级菜单", icon: 'Stamp', isRule: true },
                    }, {
                        path: "/list/item2",
                        name: "item2",
                        component: () => import("../view/list/item2/index.vue"),
                        meta: { title: "二级菜单", icon: 'Wallet', isRule: true },
                        
                    },

                ],



            }
        ]
    }, 
]
